package uy.com.csi.gestpro.model.ejbbean;

import java.util.List;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

import uy.com.csi.gestpro.model.ejbremote.AvanceEjbRemote;
import uy.com.csi.gestpro.model.view.GpVwActvdad;

@Stateless
public class AvanceEjb implements AvanceEjbRemote {
	@PersistenceContext(name = "pu_gestpro")
	EntityManager em;

	public AvanceEjb() {
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<GpVwActvdad> getActvdadLstByInfrme(Integer id) {
		List<GpVwActvdad> acvdadLst = null;
		try {
			String consulta = "select a from GpVwActvdad a where a.idInfrmeDrio=:id";
			Query q = em.createQuery(consulta);
			q.setParameter("id", id);
			acvdadLst = (List<GpVwActvdad>) q.getSingleResult();
		} catch (Exception e) {
		}
		return acvdadLst;
	}
}
